﻿
using Test30.Core;
using Test30.Util;

namespace Test30.Engine
{
    public class ElementBeamAction : BoltAction
    {
        public ElementBeamAction(NotNull<Entity> entity, Vec target, INoun noun, Attack attack)
            : base(entity, target)
        {
            _noun = noun;
            _attack = attack;
        }

        protected override bool OnEffect(Vec pos, Direction direction)
        {
            Dungeon.HitAt(pos, this, new Hit(_noun, _attack, direction));

            // stop if we hit a wall
            return !Dungeon.Tiles[pos].IsPassable;
        }

        private readonly INoun _noun;
        private readonly Attack _attack;
    }
}
